/**
 * @param {number[][]} matrix
 * @param {number} target
 * @return {boolean}
 */
var searchMatrix = function (matrix, target) {
  let m = matrix.length
  let n = matrix[0].length
  for (let i = 0; i < m; i++) {
    if (target <= matrix[i][n - 1]) {
      let left = 0
      let right = n - 1
      while (left <= right) {
        let mid = left + Math.floor((right - left) / 2)
        if (matrix[i][mid] < target) { // 如果中间的小于目标值
          left = mid + 1
        } else if (matrix[i][mid] > target) {
          right = mid - 1
        } else {
          return true
        }
      }
      return false
    }
  }
  return false
};
let matrix = [[1, 3, 5, 7], [10, 11, 16, 20], [23, 30, 34, 60]]
let target = 13
console.log(searchMatrix(matrix, target));